home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / lu62 / aopndst.c < prev    next >
C/C++ Source or Header  |  1996-07-10  |  3KB  |  119 lines

  1. /*
  2.  *
  3.  *                      OPNDST
  4.  *
  5.  * Function : This subroutine handle a VTAM style
  6.  *            OPNDST request.
  7.  * This function performs call the "pattach" subroutine
  8.  * and use the following extern vars: - sem_no, pparm.
  9.  *
  10.  *  Input    :  "Port-m segment" with NIB inserted
  11.  *               in RU.
  12.  *  Output   :  Not applicated.
  13.  *
  14.  * CopyRight 1995. Nicholas Poljakov all rights reserved.
  15.  *
  16.  */
  17. #include <include.h>
  18. #include <stdio.h>
  19. #include <malloc.h>
  20. #include <rpl.h>
  21. #include <nib.h>
  22. #include <state1.h>
  23. #include <string.h>
  24. #if OS_TYPE == 1
  25. #include <memory.h>
  26. #endif
  27.  
  28. #define PR_SIZE 31
  29.  
  30. int short sem_no;
  31. int gtf();
  32. int sk_r_wt(void *);
  33. int SendBlock(void *, void *);
  34. int setrc(void *, void *);
  35. int sendhsf(void *);
  36. int sendhs(void *);
  37. int sendbm(void *, void *);
  38. int sendat(void *);
  39. int rtsend(void *);
  40. unsigned long rmfmh5(void *, void *);
  41. int recwait(void *);
  42. int rcvru(void *, void *);
  43. int rcvhs(void *, void *, void *, void *);
  44. int ralloc(void *, void *);
  45. int psrm(int, void *, void *);
  46. int ps_conv(int, void *);
  47. int proterr(void *, unsigned long);
  48. int preptrcv(void *, void *);
  49. int post_rcb(void *);
  50. struct repass *postopen(void *);
  51. int phsrec(void *);
  52. int pfmh5(void *);
  53. int opndst(void *);
  54. int obtsess(void *, unsigned char);
  55. int Lrf_handler(void *);
  56. int get_sess(void *, void *);
  57. int get_attr(void *);
  58. int fsm_error(unsigned char, void *);
  59. int fsm_conv(unsigned char, unsigned char, void *);
  60. int flush (void *);
  61. int dcp(void *);
  62. int dealloc(void *);
  63. int crtp(void *);
  64. int conv(void *);
  65. int chkparm(void *, void *);
  66. int check_end(unsigned int, void *);
  67. struct rqb *call_appl(void *);
  68. int buffmng(unsigned char, void *, void *, void *, unsigned, unsigned char, unsigned);
  69. unsigned long attltck(void *);
  70. unsigned long attacheck(void *);
  71. char *cgetmem(int, int);
  72. int sendhsf(void *);
  73. int opndst(void *);
  74. int alloc_rcb(void *, void *);
  75. int allocate(void *);
  76. int clsdst(void *);
  77.  
  78. opndst(p_rpl)
  79. struct rpl *p_rpl;
  80. {
  81.     struct nib *p_nib;
  82.     struct rqb *p_rqb;
  83.     struct segprf *p_sp;
  84.     char *p;
  85.     int  i;
  86.     int  rc; /* Return code from this proc. */
  87.  
  88.     rc = 0;
  89.     /* Allocate a segment */
  90.     if ((p = malloc(PR_SIZE + sizeof(struct nib))) == NULL) {
  91.         return (-1);
  92.     }
  93.     p_sp = p;
  94.     i = 0;
  95.     memset(p, i, PR_SIZE + sizeof(struct nib));
  96.     p_sp -> len = sizeof(struct nib);
  97.     p_nib = p_rpl -> p_nib;
  98.     memcpy(p + PR_SIZE, p_nib, sizeof(struct nib)); /*fill RU*/
  99.  
  100.     p_rqb = p + 12; /* sizeof(struct segprf)*/
  101.  
  102.   /* Set RQB fields and call Pattach */
  103.  
  104.     p_rqb -> th.ra.stcb = APPL_CODE;
  105.     p_rqb -> th.ra.code = p_rqb -> th.ra.code & 0x3f;
  106.                                  /* from = TOP, segment */
  107.     p_rqb -> th.ra.wa.rqba.rsrlen = sem_no + ST_N;
  108.     p_rqb -> th.ra.rparm.parm.parm1 = 0; /* OPNDST */
  109.     for (i = 0; i < 4; i++) {
  110.         p_rqb ->th.ra.wa.hh.rswa[i] = p_nib -> user[i];
  111.     }
  112.  
  113.     if ((p = call_appl(p_rqb)) == NULL) {
  114.         rc = -1;
  115.     }
  116.     free(p);
  117.     return (rc);
  118. }
  119.